package com.wuseguang.springcloud.service.impl;

import com.wuseguang.springcloud.dao.jdbc.SchoolRatingLimitsJdbc;
import com.wuseguang.springcloud.service.SchoolRatingLimitsService;
import com.wuseguang.springcloud.util.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 学校评分限制 服务实现类
 * </p>
 *
 * @author
 * @since 2020-07-23
 */
@Service
public class SchoolRatingLimitsServiceImpl implements SchoolRatingLimitsService {

    private Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private SchoolRatingLimitsJdbc schoolRatingLimitsJdbc;

    @Override
    public Result findSchoolRatingLimits(String schoolId) {
        //查询学校评分限制
        String sql = "select school_id ,class_teacher_score,teacher_score from school_rating_limits where school_id = ?";
        Map<String, Object> map = null;

        try {
            map = schoolRatingLimitsJdbc.queryMap(sql, schoolId);
            //查询特殊角色分数
            sql = "select role_id,score from school_rating_limits_special where school_rating_limits_id = ?";
            List<Map<String, Object>> roleList = schoolRatingLimitsJdbc.queryListMap(sql, schoolId);
            map.put("role", roleList);

        } catch (Exception e) {
            logger.info("无数据");
        }
        return new Result(map);
    }
}
